<?php

namespace App\Admin\Actions\Post;

use Encore\Admin\Actions\Action;
use Illuminate\Database\Eloquent\Collection;

class CloseAllPost extends Action
{
    public $name = '全部关闭';

    public function handle(Collection $collection)
    {
        foreach ($collection as $model) {
            // ...
        }

        return $this->response()->success('Success message...')->refresh();
    }

    public function html()
    {
        return <<<HTML
        <a class="closeall-posts btn btn-sm btn-danger"><i class="fa fa-chain"></i>&nbsp;&nbsp;全部关闭</a>
HTML;
    }

}